//
//  UIImage+DYNinePatchProperty.m
//  DYNinePatchDemo
//
//  Created by lisr on 2018/11/5.
//  Copyright © 2018 douyu. All rights reserved.
//

#import "UIImage+DYNinePatchProperty.h"
#import <objc/message.h>

static const char *contentInsetKey = "DYNinePatch_ContentInsetKey";

@implementation UIImage (DYNinePatchProperty)

#pragma mark - runtime property

- (void)setDynp_contentInset:(UIEdgeInsets)contentInset
{
    objc_setAssociatedObject(self, contentInsetKey, [NSValue valueWithUIEdgeInsets:contentInset], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (UIEdgeInsets)dynp_contentInset
{
    NSValue *inset = objc_getAssociatedObject(self, contentInsetKey);
    return [inset UIEdgeInsetsValue];
}

@end
